package com.example.ailiyuncloud.pojo;


import lombok.Generated;

/**
 * @Author: lqj
 * @Date: 2022/08/27/15:33
 * @Description:
 */
public class BaseResponseData {
    private boolean success;
    private Object data;
    private PageInfo page;
    private String errorCode;
    private String errorMessage;

    public static BaseResponseData ofSuccess(Object obj) {
        return (new BaseResponseData()).setSuccess(true).setData(obj);
    }

    public static BaseResponseData ofSuccess(Object obj, PageInfo page) {
        return ofSuccess(obj).setPage(page);
    }


    @Generated
    public boolean isSuccess() {
        return this.success;
    }

    @Generated
    public Object getData() {
        return this.data;
    }

    @Generated
    public PageInfo getPage() {
        return this.page;
    }

    @Generated
    public String getErrorCode() {
        return this.errorCode;
    }

    @Generated
    public String getErrorMessage() {
        return this.errorMessage;
    }

    @Generated
    public BaseResponseData setSuccess(boolean success) {
        this.success = success;
        return this;
    }

    @Generated
    public BaseResponseData setData(Object data) {
        this.data = data;
        return this;
    }

    @Generated
    public BaseResponseData setPage(PageInfo page) {
        this.page = page;
        return this;
    }

    @Generated
    public BaseResponseData setErrorCode(String errorCode) {
        this.errorCode = errorCode;
        return this;
    }

    @Generated
    public BaseResponseData setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
        return this;
    }

    @Generated
    public boolean equals(Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof BaseResponseData)) {
            return false;
        } else {
            BaseResponseData other = (BaseResponseData)o;
            if (!other.canEqual(this)) {
                return false;
            } else if (this.isSuccess() != other.isSuccess()) {
                return false;
            } else {
                label61: {
                    Object this$data = this.getData();
                    Object other$data = other.getData();
                    if (this$data == null) {
                        if (other$data == null) {
                            break label61;
                        }
                    } else if (this$data.equals(other$data)) {
                        break label61;
                    }

                    return false;
                }

                label54: {
                    Object this$page = this.getPage();
                    Object other$page = other.getPage();
                    if (this$page == null) {
                        if (other$page == null) {
                            break label54;
                        }
                    } else if (this$page.equals(other$page)) {
                        break label54;
                    }

                    return false;
                }

                Object this$errorCode = this.getErrorCode();
                Object other$errorCode = other.getErrorCode();
                if (this$errorCode == null) {
                    if (other$errorCode != null) {
                        return false;
                    }
                } else if (!this$errorCode.equals(other$errorCode)) {
                    return false;
                }

                Object this$errorMessage = this.getErrorMessage();
                Object other$errorMessage = other.getErrorMessage();
                if (this$errorMessage == null) {
                    if (other$errorMessage != null) {
                        return false;
                    }
                } else if (!this$errorMessage.equals(other$errorMessage)) {
                    return false;
                }

                return true;
            }
        }
    }

    @Generated
    protected boolean canEqual(Object other) {
        return other instanceof BaseResponseData;
    }

    @Generated
    public int hashCode() {
        boolean PRIME = true;
        int result = 1;
        result = result * 59 + (this.isSuccess() ? 79 : 97);
        Object $data = this.getData();
        result = result * 59 + ($data == null ? 43 : $data.hashCode());
        Object $page = this.getPage();
        result = result * 59 + ($page == null ? 43 : $page.hashCode());
        Object $errorCode = this.getErrorCode();
        result = result * 59 + ($errorCode == null ? 43 : $errorCode.hashCode());
        Object $errorMessage = this.getErrorMessage();
        result = result * 59 + ($errorMessage == null ? 43 : $errorMessage.hashCode());
        return result;
    }

    @Generated
    public String toString() {
        return "BaseResponseData(success=" + this.isSuccess() + ", data=" + this.getData() + ", page=" + this.getPage() + ", errorCode=" + this.getErrorCode() + ", errorMessage=" + this.getErrorMessage() + ")";
    }

    @Generated
    public BaseResponseData() {
    }
}
